using System.Collections.Generic;

namespace SQLServices.RunnableItems
{
    /// <summary>
    /// Project item: folder or script. A folder is not executed but it can be selected or
    /// ignored. A script can be executed, it can be also selected or ignored.
    /// </summary>
    public interface IProjectItem
    {
        /// <summary>
        /// When a new instance is created the status is set to PENDING, once
        /// the item is executed it can be set to EXECUTED_OK or EXECUTED_WITH_ERROR
        /// </summary>
        RunnableState State{ get; set; }

        /// <summary>
        /// Short name for the item, normally the file or folder name
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Once the item is executed it stores the reason for the failure
        /// </summary>
        string Error { get; set; }

        /// <summary>
        /// Allows to navigate up in the hierarchy of items
        /// </summary>
        IProjectItem Parent { get; }
        
        /// <summary>
        /// Items can be ignored when the project is executed, 
        /// used it for visibility/filtering purpose
        /// </summary>
        bool Ignore { get; set; }

        /// <summary>
        /// Before the execution the items can be selected/unselected
        /// </summary>
        bool Selected { get; set; }

        /// <summary>
        /// Stores the full and relative path of the item, it shoud be able to workout
        /// the full path from a relative path and a project root path
        /// </summary>
        IItemPath Path { get; }
    }
}